/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio.lista1;

import java.util.Random;

/**
 *
 * @author afonso
 */
public class Questao6 {

    public static void main(String[] args) {
        Random rand = new Random();
        int nExp = 1000;
        int evento = 0;
        for (int i = 0; i < nExp; i++) {
            int bola;
            do {
                bola = rand.nextInt(11) + 1;
            } while (bola > 5 && bola < 10);
            if (bola <= 5) {
                evento++;
            }
        }
        double p = (double) evento / nExp;
        System.out.println("Probabilidade: "+p);
    }
}
